/*    */ package com.zimbra.cs.account.ldap.upgrade;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.StringUtil;
/*    */ import com.zimbra.cs.account.Config;
/*    */ import com.zimbra.cs.account.Entry;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import com.zimbra.cs.account.ldap.LdapProv;
/*    */ import com.zimbra.cs.ldap.LdapClient;
/*    */ import com.zimbra.cs.ldap.LdapServerType;
/*    */ import com.zimbra.cs.ldap.LdapUsage;
/*    */ import com.zimbra.cs.ldap.ZLdapContext;
/*    */ import java.util.Arrays;
/*    */ import java.util.HashMap;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class BUG_57205
/*    */   extends UpgradeOp
/*    */ {
/*    */   void doUpgrade()
/*    */     throws ServiceException
/*    */   {
/* 43 */     ZLdapContext zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.UPGRADE);
/*    */     try {
/* 45 */       doGlobalConfig(zlc);
/* 46 */       doAllServers(zlc);
/*    */     } finally {
/* 48 */       LdapClient.closeContext(zlc);
/*    */     }
/*    */   }
/*    */   
/*    */   void doEntry(ZLdapContext zlc, Entry entry) throws ServiceException {
/* 53 */     this.printer.printCheckingEntry(entry);
/*    */     
/* 55 */     String attrName = "zimbraReverseProxyImapEnabledCapability";
/*    */     
/* 57 */     String[] curValues = entry.getMultiAttr(attrName, false);
/* 58 */     if (curValues.length == 0)
/*    */     {
/* 60 */       return;
/*    */     }
/*    */     
/* 63 */     List<String> curValueList = Arrays.asList(curValues);
/*    */     
/* 65 */     Map<String, Object> attrs = new HashMap();
/*    */     
/* 67 */     if (!curValueList.contains("LIST-STATUS")) {
/* 68 */       StringUtil.addToMultiMap(attrs, "+" + attrName, "LIST-STATUS");
/*    */     }
/*    */     
/* 71 */     if (!curValueList.contains("XLIST")) {
/* 72 */       StringUtil.addToMultiMap(attrs, "+" + attrName, "XLIST");
/*    */     }
/*    */     
/* 75 */     if (!attrs.isEmpty()) {
/* 76 */       modifyAttrs(entry, attrs);
/*    */     }
/*    */   }
/*    */   
/*    */   private void doGlobalConfig(ZLdapContext zlc) throws ServiceException
/*    */   {
/* 82 */     Config config = this.prov.getConfig();
/* 83 */     doEntry(zlc, config);
/*    */   }
/*    */   
/*    */   private void doAllServers(ZLdapContext zlc) throws ServiceException {
/* 87 */     List<Server> servers = this.prov.getAllServers();
/*    */     
/* 89 */     for (Server server : servers) {
/* 90 */       doEntry(zlc, server);
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/account/ldap/upgrade/BUG_57205.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */